/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package OpenClosedPrincipleTest;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import za.ac.cput.OpenClosedPrincipleCompliance.Conf.Confg;
import org.springframework.context.ApplicationContext;
import za.ac.cput.OpenClosedPrincipleCompliance.Impl.AccountType;
import za.ac.cput.OpenClosedPrincipleCompliance.Account;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;

/**
 *
 * @author Leo
 */
public class AccountsTesting {
    
    private static ApplicationContext ctx ;
    private static Account acc;
    
    public AccountsTesting() {
    }

    @BeforeClass
    public static void setUpClass() throws Exception {
        
        ctx = new AnnotationConfigApplicationContext(Confg.class);
        acc =  (Account) ctx.getBean("accT");
    
    }

    @AfterClass
    public static void tearDownClass() throws Exception {
    }
    
    @Before
    public void setUp() {
    }
    
    @After
    public void tearDown() {
    }
    // TODO add test methods here.
    // The methods must be annotated with annotation @Test. For example:
    //
     @Test
     public void testAccount() {
     
         acc = new AccountType();
        
         double amnt = 100;
         double oldB = acc.getBalance();
         acc.deposit(amnt);
         
         assertTrue(acc.getBalance()==oldB + amnt);
     }
}
